fixed code to work with new stuff
fixed code to work with new stuff