Howdy!
I know that this (quite) a bit late, but just in case you or somebody else has this problem later, I thought it would be a good idea to answer it.
Simply put, the layer that you set an object to in the editor is never going to be the same as the number that represents it in code. Take a look at this screenshot:

My mouse is hovering over Collision Layer "4", but the "value" is saying that any code in my game would see the layer as the number "8". So what's happening in your game is that Collision Layer "0" actually has an in-code "value" of 1.