Fixed JS remove(element) error