modified if statement for existing errors