fixed case when args contains value or null instead of array

If $args contains single value or null server returns error because array is expected. Added some corrections to send function.