improved the frame handling a bit