fixes #22, 21, 20, 16