Error when trying to modify locked objects, add lock function to object prototype