Removed debug code and added hack to make work with MS