Fixed rect init values.
removed debug variable.
Some more casting magic.