check isset($attachment[0]) before returning it