some fixes + kenny's code