fix bug that Luis Coelho points out