frames: part of refactoring bugs fixed