fixes #12, #11, #6