this fixes #386, #346, #299, #288, #285, #284, #279