fix return exit value, shared libs cannot use exit, but return instead