Fixed null pointer with passing return type