fix bug in creating resources