Fixes #277 #349