Backported fix from vitalidze/dev commit a8683ff;  Added additional code to User.java for added protection;