Add error checking to prevent errors when building from scratch