Stability fixes and additional error checking