more bug fixes

Fixed #59
#52