     JUser = require './user'
     JGuest = require './guest'
     {delegate} = client.connection
-    unless delegate instanceof JGuest
+    unless delegate.type is 'unregistered'
       callback new KodingError 'You are already logged in.'
     else
       JUser.one {username}, (err, user)=>

  @resetPassword = secure (client, token, newPassword, callback)->
    JUser = require './user'
    {delegate} = client.connection
    unless delegate instanceof JGuest
      callback new KodingError 'You are already logged in!'
    else
      @one {token}, (err, certificate)->

    JUser = require './user'
    JGuest = require './guest'
    {delegate} = client.connection
    unless delegate.type is 'unregistered'
      callback new KodingError 'You are already logged in.'
    else
      JUser.count {email}, (err, num)=>
