fixed null checks