refactor resource creation
more error info