Fixed errors from old code merge