Remove -l parameter from su.  This forces the users enviroment to be loaded which changes the CWD
Change branch parameter to real_branch where appropriate.