fixing error in assuming error is a string