Various Bug fixes to get stuff working