Bug fixes and authentication improvement made

Change-Id: If5cc03d9d0c7f90044222a79b93954ec2731a5cd