Fix the bug where certain functions were returning meaningful return and/or error code, where positive values of error codes were interfering with meaningful return value. Error codes now have negative values as it was originally intended but never implemented.