corrected replaceData and added length property