Assert fix & error handling