Fixed all remaining memory leaks. Fixes #969, Fixes #919

* Fixed bug with inventory flag not being set properly when using RP2
containers.
* Fixed issue with dimensions being casted to bytes in moveToWorld method.
* Cleaned up some code.