bug fixing across platforms and cleaning up