throwing an exception instead of returning null