fix formatting and test for correct error