fixed error propagation and formatting