return null for bad input