fixes #286 and fixes #285 and fixes #284 and fixes #277