fixes #36, fixes #24, many other things