updated version and tests for findById to return null if not found