fixing null-pointer crash