fixed null pointer when no result is returned