api login

Bug fixes with api login