bugs fixed, catching errors in remote endpoint function