Fixing various crash and draw bugs