fixed #284 and #243