This won't work in the define because it gets defined every time which causes a duplicate resource error. You need to move it outside of the define.