fixed a bug in .remove when dealing with arrays