Compiler error added to wait statment