Fixed bug in send application function