minor fixes and variable corrections 

This fix issues with uploading and deleting images.
(MySQL errors was do to a typo on my part "[Id]" change back to "[id]"