fix getting filename and extensions to not use absolute paths