Issue #49: got rid of hacky code