fix for #24 thanks to alexparvulescu