fix #50 but it's not perfect