When executing 'creep.drop(RESOURCE_ENERGY, 0);', instead of dropping nothing, the creep drops all carried energy. (Althought you would rarely explicitly drop 0, in my case 0 was the result of some formula. Took me a while to get while sometimes all energy was dropped...)
On the other hand, it's good that you don't waste 0.2 CPU on dropping nothing, but still, the behavior is quite non-intuitive...
The fix most likely would be to not use 'if(!arg)' to test whether the argument is undefined