Fixed some bugs and added image support