Fixed some assertion failures

Fixed assertion failures related to imagebuf.cpp