fixing .rm "undefined" bug