Fixed bug in APF implementation.