several bug fixes which have been found while developing https://github.com/Doboy/underscore