Fixed gsend function