realpath not dir namt
using real path instead of dirname
dirname of realpath for join