Replaced sh with bash. Added checks when registering paths