Fixing if statement error