error msgs working but getting error if anything is missing