Form conditions not working properly