fixed the bug in signup, exhaustivley tested