fixes #32, thanks to stackoverflow!