Conditions not working when copying the source code