Fixed NSProxy implementation to avoid exceptions in real world applications

Fixes necessary to avoid crashs.