Some bug fixes

Just some bug fixes, not a major commit