Use toUInt instead of toInt
Removed unneeded includes
Check if context is valid
Safely unbind after drawing
Destructor fix