Fixed minor errors in code