Adding missing release() and return for several functions.