Code was not inside if