Error fix and a few smaller enhancements