fixed bug if required fields is empty