Tested and bugfixed.