Fixed typos and conditions

wrote it too fast :)