Add context null check in oncreate clauses

Tries to fix null pointer excpetions without knowledge of where these empty contexts come from.
Attempt to fix #38 and #52