Working version - size sometimes fails
lock working version