restored null checks