js error when removing object from model

Not sure why it fails sometimes, but removing works