fixes some of the issues mentioned in #36