fixed some errors on remote execution handling
implemented clean appdir cleanup