fix thumbnail function