addressing issues #553 and #554 by @OlegHahm