Cast to object before checking for null
Execute loop before removing items
Package version 0.2.2