Another minor bug fix that should catch more errors