fix #614 as suggested by @jvasileff