Null pointer exc. corrected