Fixing some sloppy code that reached shell but caused an error