use sizeof, fix registration and login failed message