fixed bug for replacing js models