Misc fixes

Just some miscellaneous things that were found and fixed. Feel free to leave feedback.