fix nested remoting function throwing error will crash app

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
test if cb exists

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
fix jshint errors

Signed-off-by: Clark Wang <clark.wangs@gmail.com>
Merge pull request #907 from clarkorz/fix/nestRemoting-crash

fix nested remoting function throwing error will crash app