added getLayer
a bit of optimizations for fillRec/fillParams