Minor fixes and cleanup
Message error and line insert fix