fix critical exception - null pointer exception