Fixed bug in inline images (this is a bug obtained from Chris's branch)