Fixes #310 and #250

Fixes #310 and #250