fixed bug when determining script_dir and the script is actually a sym linked