removal of invalid images