fixed #24, although a bit hacky