Added some additional error checking to the memory module

- Fixed a bug with TypeManager.convert()
- Made setting pointer attributes more secure