fixed procedural bugs
merge