Solving problem with empty fields