Fix for null-pointer exception