Devise upgrade and bug fixing