I tried giving the arguments in normal order for  a while but Emacs kept reading it in reverse for some crazy reason. This seemed to solve the problem but I don't really understand why.