changed osp.dirname() to osp.dirname(osp.abspath())