Fixing some issues discovered while testing