Fixed imageWith and imageHeight called before image
Added a test for the latest bug fixed