Various bug fixes with legacy code conversion.
Various bug fixes with legacy code conversion.

polyethene/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,polyethene/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,michaltakac/IronAHK,yatsek/IronAHK,polyethene/IronAHK,michaltakac/IronAHK,michaltakac/IronAHK,polyethene/IronAHK,yatsek/IronAHK,yatsek/IronAHK