fixed bug in reg controller