fixes #27, #28, #33