preventing an 'undefined' error in remove()

and ran jsformat