Some quick fixes
Fixed all error checks