Fix startup sequence and add some error checking