Made a better drop function to avoid RangeError on stack
Merge from github