Resolved some bugs in FrameBuffer management