Added some type checks in render lib functions.

Minor codestyle improvements in affected functions.
Fixes #248