added some code to fix