Fixing more errors

This is functional version.